﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Class2
    {
        public static void work()
        {
            node h = new node();
            h.i = 0;
            node a = new node();
            a.i = 1;
            node b = new node();
            b.i = 2;
            node c = new node();
            c.i = 3;
            h.next = a;
            a.next = b;
            b.next = c;

            caozuo.bianli(h);
            caozuo.fanxiang(h);
            caozuo.bianli(c);





        }
    }
    class node
    {
        public int i;
        public node next;
    }
    class caozuo
    {
        public static void bianli(node h)
        {
            node p;
            p = h;
            while (p != null)
            {
                Console.WriteLine(p.i);
                p = p.next;

            }
        }

        public static void fanxiang(node h)
        {
            //node p;
            //p = h;
            if (h.next.next != null)
            {
                fanxiang(h.next);


            }

            h.next.next = h;
            h.next = null;

        }
    }


}
